<?php

require('generator.php');

// database config

$config_meta['db_host'] = 'localhost';
$config_meta['db_user'] = 'toor';
$config_meta['db_pass'] = '';
$config_meta['db_name'] = 'ta';

$config_data['db_host'] = 'localhost';
$config_data['db_user'] = 'toor';
$config_data['db_pass'] = '';
$config_data['db_name'] = 'dummy';

// rules

// generation

$generator = new generator($config_meta, $config_data, $rule);
$html = $generator->generate('view1');

// print

echo '<!doctype html><html><head><style>
td{border:1px solid black;padding:3px 6px}
table{border-collapse:collapse}
</style></head><body>'.$html.'</body></html>';

//

/* trash code

$rule['h1']['value'] = 'Isi Table Elements';
$rule['td1']['values'] = ['Element ID',
                          'Element Type',
                          'Child of Element',
                          'Static Value'];
$rule['tr2']['query'] = '
    select id,type,child,value
    from elements
';

//

$generator = new generator($config_meta, $config_data, $rule);
$html .= $generator->generate('view1');

// rule for nilai mahasiswa

$rule['h1']['value'] = 'Nilai IF4099';
$rule['td1']['items'] = ['Nomor Induk',
                          'Nama Pendek',
                          'Nilai Sementara'];
$rule['tr2']['query'] = '
    select nim,nama,nilai
    from mahasiswa
';

// rule for data kependudukan

$rule['p1']['items'] = ['', ''];
$rule['br1']['items'] = ['', '', '', '', ''];

$html .= $generator->generate('insert1');

*/
